import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "Students")
public class Student {
	
	@Id
	@Column(name= "user_id")
	private Integer user_id;
	
	@Column(name= "first_name")
	private String stud_first_name;
	
	@Column(name= "last_name")
	private String stud_last_name;
	
	@Column(name= "birthday")
	private Date birthday;
	
	@Column(name= "course")
	private Integer course;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "faculty_id")
	private Faculty facult;
	
	@Column(name= "group_num")
	private Integer group_num;
	
	@OneToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "Exam_results",
	joinColumns = @JoinColumn(name = "user_id"),
	inverseJoinColumns = @JoinColumn(name = "exam_id"))	
	private List<Exam> exam;
	
	@Column(name= "note")
	private String note;
	
	//getters
	
	public Integer getId(){return this.user_id;}
	
	public String getFirst_name(){return this.stud_first_name;}
	
	public String getLast_name(){return this.stud_last_name;}
	
	public Date getBirthday(){return this.birthday;}
	
	public Integer getCourse(){return this.course;}
	
	public Faculty getFaculty(){return this.facult;}
	
	public Integer getGroup_num(){return this.group_num;}
	
	public List<Exam> getExam(){return this.exam;}
	
	public String getNote(){return this.note;}
	
	//setters
	
	public void setId(Integer id) {this.user_id = id;}
	
	public void setFirst_name(String first_name) {this.stud_first_name = first_name;}
	
	public void setLast_name(String last_name) {this.stud_last_name = last_name;}
	
	public void setBirthday(Date birthday){this.birthday=birthday;}
	
	public void setCourse(Integer course){this.course=course;}
	
	public void setFaculty(Faculty facult){this.facult=facult;}
	
	public void setGroup_num(Integer group_num){this.group_num=group_num;}
	
	public void setExam(List<Exam> exam){this.exam=exam;}
	
	public void setNote(String note){this.note=note;}
}
